// 23位缩水工具
<template>
    <div>
        <div class="shrinkageBox">
            <!-- 菜单 -->
           <div class="shrinkageBox-tools flex flex-align-center">
               <div class="shrinkageBox-tools-left">
                   <p class="tools-tips">缩水工具</p>
                   <div class="tools-box flex flex-align-center flex-pack-center">
                       <div class="tools-box-item" :class="{'item-active':itemIndex==1}" @click="onChangeTab"><p>二星缩水工具</p></div>
                       <div class="tools-box-item" :class="{'item-active':itemIndex==2}" @click="onChangeTab"><p>三星缩水工具</p></div>
                   </div>
               </div>
               <div class="shrinkageBox-tools-left shrinkageBox-tools-right" v-if='false'>
                   <p class="tools-tips">更多功能</p>
                   <div class="tools-box flex flex-align-center">
                       <div class="tools-box-item" :class="{'item-active':itemIndex==3}" @click="onChangeTab"><p>多能缩水工具</p></div>
                   </div>
               </div>
           </div>
           <!-- 内容 -->
           <div class="toolsBox flex">
                <!-- 左边部分 -->
                <div class="toolsBox-left flex flex-v">
                    <!-- 位数 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in fixedArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,0,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,0,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,0,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,0,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 跨码 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in crossspanArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,1,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,1,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,1,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,1,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 类型 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in formArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,2,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,2,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,2,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,2,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 连号 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in linkCodeArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,3,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,3,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,3,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,3,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 和尾 -->
                    <div class="numBox hezhiBox"  style="border:none">
                        <div v-for='(item,index) in tailingArr' :key="index" class="flex">
                            <div class="nomRow flex flex-align-center">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,4,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,4,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,4,item.digit)">
                            </div>
                            <div class="numBox" :class="{numBox2:itemIndex == 1}">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,4,item.titel,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                    <!-- 和值 -->
                    <div class="numBox hezhiBox">
                        <div v-for='(item,index) in sumArr' :key="index" class="flex">
                            <div class="nomRow flex flex-align-center">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,5,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,5,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,5,item.digit)">
                            </div>
                            <div class="numBox" :class="{numBox2:itemIndex == 1}">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,5,item.titel,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                         <div class="h"></div>
                    </div>
                    <!-- 012路 -->
                    <div class="numBox hezhiBox"  style="border:none">
                        <div v-for='(item,index) in type012Arr' :key="index" class="flex">
                            <div class="nomRow flex flex-align-center" style="width:1.2rem">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,6,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,6,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,6,item.digit)">
                            </div>
                            <div class="numBox" :class="{numBox2:itemIndex == 1}">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,6,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                        <div class="h"></div>
                    </div>
                </div>
                <!-- 右边部分 -->
                <div class="toolsBox-right">
                    <!-- 胆码 -->
                    <div class="numBox">
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in biliaryArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,7,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,7,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,7,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,7,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h"></div>
                    </div>
                    <!-- 大小比/奇偶比/质合比 -->
                    <div class="numBox" v-if='itemIndex == 2'>
                        <div class="nomRow flex flex-align-center" v-for='(item,index) in sizeradioArr' :key="index">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,8,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,8,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,8,item.digit)">
                            <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,8,item.digit,it.num)"><p>{{it.num}}</p></div>
                        </div>
                        <div class="h" style="height:0.04rem"></div>
                    </div>
                    <!--  奇偶 -->
                    <div class="numBox hezhiBox"  style="border:none">
                        <div v-for='(item,index) in oddevenArr' :key="index" class="flex">
                            <div class="nomRow flex flex-align-center" style="width:1.2rem">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,9,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,9,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,9,item.digit)">
                            </div>
                            <div class="numBox" style="width:2rem;" :class="{numBox2:itemIndex == 1}">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,9,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                    <!-- 大小 -->
                    <div class="numBox hezhiBox"  style="border:none">
                        <div v-for='(item,index) in sizestrArr' :key="index" class="flex">
                            <div class="nomRow flex flex-align-center" style="width:1.2rem" >
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,10,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,10,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,10,item.digit)">
                            </div>
                            <div class="numBox" style="width:2rem" :class="{numBox2:itemIndex == 1}">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,10,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                    <!-- 质合 -->
                     <div class="numBox hezhiBox">
                        <div v-for='(item,index) in coincidenceArr' :key="index" class="flex">
                            <div class="nomRow flex flex-align-center" style="width:1.2rem">
                            <p>{{item.digit}}</p>
                            <div class="dmbox" @click="onChangedmBox(index,11,item.digit)" :class="{'dmbox-active':item.isChangedmBox}"><p v-if='!item.isChangedmBox'>定码</p><p v-if='item.isChangedmBox'>杀码</p></div>
                            <img src="@/assets/img/shrinkagetool/qx.png" alt="" @click="onQxFun(index,11,item.digit)">
                            <img src="@/assets/img/shrinkagetool/qxqx.png" alt="" @click="onQuXiaoFun(index,11,item.digit)">
                            </div>
                            <div class="numBox" style="width:2rem" :class="{numBox2:itemIndex == 1}">
                                <div class="numIcon flex flex-align-center flex-pack-center" :class="{'numIcon-active':it.status == 1}" v-for='(it,e) in item.numTextArr' :key='e' @click="onChangeItem(index,e,11,item.digit,it.num)"><p>{{it.num}}</p></div>
                            </div>
                        </div>
                    </div>
                    <!-- 操作面板 -->
                    <div class="numBox" style="border:none;">
                        <div class="hezhi-Tools">
                                <div class="TabsBox flex">
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onGenerateFun">
                                        <img src="@/assets/img/shrinkagetool/shengc.png" alt="">
                                        <p>生成</p>
                                    </div>
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onRotationGroupFun">
                                        <img src="@/assets/img/shrinkagetool/zzx.png" alt="">
                                        <p>转组选</p>
                                    </div>
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onExportFun">
                                        <img src="@/assets/img/shrinkagetool/dc.png" alt="">
                                        <p>导出</p>
                                    </div>
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onCopyFun">
                                        <img src="@/assets/img/shrinkagetool/fz.png" alt="">
                                        <p>复制</p>
                                    </div>
                                    <div class="tabs-item flex flex-align-center flex-pack-center" @click="onResetFun">
                                        <img src="@/assets/img/shrinkagetool/cz.png" alt="">
                                        <p>重置所有条件</p>
                                    </div>
                                </div>
                                <p class="tips">本次生成{{total_num}}注</p>
                        </div>
                    </div>                
                </div>
           </div>
                <div class="Num-Box">
                        <textarea readonly='true' v-model="NumVal" id='textCont'></textarea>
                </div>   
        </div>
    </div>
</template>
<script>
import Date from '@/assets/js/shrinkagetoolthreebitsjson';
export default {
    data () {
        return {
            itemIndex:1, //选择菜单
            total_num:0, //生成注数
            NumVal:'', //生成数据
            star_num:2, //几星缩水，2/二星；3/三星
            is_turn:0, //是否转组选, 0/未转组选
            file_name:'二星缩水结果',
            is_client_export:0, //是否导出
            fixedArr:[], //位数
            crossspanArr: [], //跨码
            formArr: [], //类型
            linkCodeArr: [], //连号
            tailingArr: [], // 和尾
            sumArr: [], //和值
            type012Arr: [], // 012路
            biliaryArr:[], //胆码
            sizeradioArr:[], //大小比/奇偶比/质合比
            oddevenArr: [],   // 奇偶
            sizestrArr: [], //大小
            coincidenceArr: [], //质合

             // 各个标签杀码定码字段
            hundred_fixed_code_type:1, //百位定码
            ten_fixed_code_type:1, //十位定码
            position_fixed_code_type:1, //个位定码
            hundred_biliary_code_type:1, //百位胆码
            ten_biliary_code_type:1, //十位胆码
            position_biliary_code_type:1, //个位胆码
            cross_span_code_type:1, //跨码
            code_form_type:1, //定码
            code_size_str_type:1, //大小
            odd_even_code_type:1, //奇偶
            code_coincidence_type:1, //质合
            code_size_type:1, //大小比
            parity_radio_code_type:1, //奇偶比
            mass_radio_code_type:1, //质合比
            link_code_type:1, //连号
            sum_code_type:1, //和值
            tailing_code_type:1, // 和尾
            code_type_012_type:1, //012路

             // 数组
            hundred_fixed_code_data:[], //百位定码
            ten_fixed_code_data:[], //十位定码
            position_fixed_code_data:[], //个位定码
            hundred_biliary_code_data:[], //百位胆码
            ten_biliary_code_data:[], //十位胆码
            position_biliary_code_data:[], //个位胆码
            cross_span_code_data:[], //跨码
            code_form_data:[], //定码
            code_size_str_data:[], //大小
            odd_even_code_data:[], //奇偶
            code_coincidence_data:[], //质合
            code_size_data:[], //大小比
            parity_radio_code_data:[], //奇偶比
            mass_radio_code_data:[], //质合比
            link_code_data:[], //连号
            sum_code_data:[], //和值
            tailing_code_data:[], // 和尾
            code_type_012_data:[], //012路
        }
    },
    mounted () {
        this.fixedArr=Date.fixedArr2; //位数
        this.crossspanArr=Date.crossspanArr2; //跨码
        this.formArr=Date.formArr2; //类型
        this.linkCodeArr=Date.linkCodeArr2; //连号
        this.tailingArr=Date.tailingArr2; // 和尾
        this.sumArr=Date.sumArr2; //和值
        this.type012Arr=Date.type012Arr2; // 012路
        this.biliaryArr=Date.biliaryArr2; //胆码
        this.oddevenArr=Date.oddevenArr2;   // 奇偶
        this.sizestrArr=Date.sizestrArr2; //大小
        this.coincidenceArr=Date.coincidenceArr2; //质合
    },
    methods: {
        //菜单切换
        onChangeTab(ele){ 
            if(ele.target.innerText == '二星缩水工具' && this.itemIndex != 1){
                this.NumVal='';
                this.total_num=0;
                this.itemIndex = 1;
                this.star_num = 2;
                this.resetNum();
                this.file_name='二星缩水结果';
                this.fixedArr=Date.fixedArr2; //位数
                this.crossspanArr=Date.crossspanArr2; //跨码
                this.formArr=Date.formArr2; //类型
                this.linkCodeArr=Date.linkCodeArr2; //连号
                this.tailingArr=Date.tailingArr2; // 和尾
                this.sumArr=Date.sumArr2; //和值
                this.type012Arr=Date.type012Arr2; // 012路
                this.biliaryArr=Date.biliaryArr2; //胆码
                this.oddevenArr=Date.oddevenArr2;   // 奇偶
                this.sizestrArr=Date.sizestrArr2; //大小
                this.coincidenceArr=Date.coincidenceArr2; //质合
            }else if(ele.target.innerText == '三星缩水工具' && this.itemIndex != 2){
                this.NumVal='';
                this.total_num=0;
                this.itemIndex = 2;
                this.star_num = 3;
                this.resetNum();
                this.file_name='三星缩水结果';
                this.fixedArr=Date.fixedArr3; //位数
                this.crossspanArr=Date.crossspanArr3; //跨码
                this.formArr=Date.formArr3; //类型
                this.linkCodeArr=Date.linkCodeArr3; //连号
                this.tailingArr=Date.tailingArr3; // 和尾
                this.sumArr=Date.sumArr3; //和值
                this.type012Arr=Date.type012Arr3; // 012路
                this.biliaryArr=Date.biliaryArr3; //胆码
                this.oddevenArr=Date.oddevenArr3;   // 奇偶
                this.sizeradioArr = Date.sizeradioArr3; //大小比
                this.sizestrArr=Date.sizestrArr3; //大小
                this.coincidenceArr=Date.coincidenceArr3; //质合
            }else if(ele.target.innerText == '多能缩水工具'){
                 this.itemIndex = 3;
            }
        },

        // 定码杀码
        onChangedmBox(ele,type,group){
            if(type === 0){
                this.fixedArr[ele].isChangedmBox = !this.fixedArr[ele].isChangedmBox;
                if(this.fixedArr[ele].isChangedmBox){
                    switch(group){
                        case '百位': this.hundred_fixed_code_type = 2;break;
                        case '十位': this.ten_fixed_code_type = 2;break;
                        case '个位': this.position_fixed_code_type = 2;break;
                    }
                }else{
                     switch(group){
                        case '百位': this.hundred_fixed_code_type = 1;break;
                        case '十位': this.ten_fixed_code_type = 1;break;
                        case '个位': this.position_fixed_code_type = 1;break;
                    }
                }
            }else if(type === 1){ //跨码
                this.crossspanArr[ele].isChangedmBox = !this.crossspanArr[ele].isChangedmBox;
                if(this.crossspanArr[ele].isChangedmBox){
                    this.cross_span_code_type = 2;
                }else{
                    this.cross_span_code_type = 1;
                }
            }else if(type === 2){ //类型
                this.formArr[ele].isChangedmBox = !this.formArr[ele].isChangedmBox;
                if(this.formArr[ele].isChangedmBox){
                    this.code_form_type = 2;
                }else{
                    this.code_form_type = 1;
                }
            }else if(type === 3){ //连号
                this.linkCodeArr[ele].isChangedmBox = !this.linkCodeArr[ele].isChangedmBox;
                if(this.linkCodeArr[ele].isChangedmBox){
                    this.link_code_type = 2;
                }else{
                    this.link_code_type = 1;
                }
            }else if(type === 4){ // 和尾
                this.tailingArr[ele].isChangedmBox = !this.tailingArr[ele].isChangedmBox;
                if(this.tailingArr[ele].isChangedmBox){
                    this.tailing_code_type = 2;
                }else{
                    this.tailing_code_type = 1;
                }
            }else if(type === 5){ // 和值
                this.sumArr[ele].isChangedmBox = !this.sumArr[ele].isChangedmBox;
                if(this.sumArr[ele].isChangedmBox){
                    this.sum_code_type = 2;
                }else{
                    this.sum_code_type = 1;
                }
            }else if(type === 6){ // 012路
                this.type012Arr[ele].isChangedmBox = !this.type012Arr[ele].isChangedmBox;
                if(this.type012Arr[ele].isChangedmBox){
                    this.code_type_012_type = 2;
                }else{
                    this.code_type_012_type = 1;
                }
            }else if(type === 7){ // 胆码
               this.biliaryArr[ele].isChangedmBox = !this.biliaryArr[ele].isChangedmBox;
               if(this.biliaryArr[ele].isChangedmBox){
                    switch(group){
                        case '胆码3': this.hundred_biliary_code_type = 2;break;
                        case '胆码2': this.ten_biliary_code_type = 2;break;
                        case '胆码1': this.position_biliary_code_type = 2;break;
                    }
                }else{
                     switch(group){
                        case '胆码3': this.hundred_biliary_code_type = 1;break;
                        case '胆码2': this.ten_biliary_code_type = 1;break;
                        case '胆码1': this.position_biliary_code_type = 1;break;
                    }
                }
            }else if(type === 8){ //大小比/奇偶比/质合比
                this.sizeradioArr[ele].isChangedmBox = !this.sizeradioArr[ele].isChangedmBox;
                if(this.sizeradioArr[ele].isChangedmBox){
                    switch(group){
                        case '大小比': this.code_size_type = 2;break;
                        case '奇偶比': this.parity_radio_code_type = 2;break;
                        case '质合比': this.mass_radio_code_type = 2;break;
                    }
                }else{
                    switch(group){
                        case '大小比': this.code_size_type = 1;break;
                        case '奇偶比': this.parity_radio_code_type = 1;break;
                        case '质合比': this.mass_radio_code_type = 1;break;
                    }
                }
            }else if(type === 9){ //奇偶
                this.oddevenArr[ele].isChangedmBox = !this.oddevenArr[ele].isChangedmBox;
                if(this.oddevenArr[ele].isChangedmBox){
                    this.odd_even_code_type = 2;
                }else{
                    this.odd_even_code_type = 1;
                }
            }else if(type === 10){ //大小
                this.sizestrArr[ele].isChangedmBox = !this.sizestrArr[ele].isChangedmBox;
                if(this.sizestrArr[ele].isChangedmBox){
                    this.code_size_str_type = 2;
                }else{
                    this.code_size_str_type = 1;
                }
            }else if(type === 11){
                this.coincidenceArr[ele].isChangedmBox = !this.coincidenceArr[ele].isChangedmBox;
                if(this.coincidenceArr[ele].isChangedmBox){
                    this.code_coincidence_type = 2;
                }else{
                    this.code_coincidence_type = 1;
                }
            }
        },

        // 全选
        onQxFun(index,type,group){
            if(type === 0){ //位数
                for(var i in this.fixedArr[index].numTextArr){
                    this.fixedArr[index].numTextArr[i].status = 1;
                    switch(group){
                        case '百位':
                                this.hundred_fixed_code_data.push(this.fixedArr[index].numTextArr[i].num);
                            break;
                        case '十位':
                                this.ten_fixed_code_data.push(this.fixedArr[index].numTextArr[i].num);
                            break;
                        case '个位':
                                this.position_fixed_code_data.push(this.fixedArr[index].numTextArr[i].num);
                            break;
                    }
                }
            }else if(type === 1){ //跨码
                for(var i in this.crossspanArr[index].numTextArr){
                    this.crossspanArr[index].numTextArr[i].status = 1;
                     this.cross_span_code_data.push(this.crossspanArr[index].numTextArr[i].num);
                }
            }else if(type === 2){ //类型
                for(var i in this.formArr[index].numTextArr){
                    this.formArr[index].numTextArr[i].status = 1;
                     this.code_form_data.push(this.formArr[index].numTextArr[i].num);
                }
            }else if(type === 3){ //连号
                for(var i in this.linkCodeArr[index].numTextArr){
                    this.linkCodeArr[index].numTextArr[i].status = 1;
                    this.link_code_data.push(this.linkCodeArr[index].numTextArr[i].num);
                }
            }else if(type === 4){ //尾和
                for(var i in this.tailingArr[index].numTextArr){
                    this.tailingArr[index].numTextArr[i].status = 1;
                    this.tailing_code_data.push(this.tailingArr[index].numTextArr[i].num);
                }
            }else if(type === 5){ //和值
                for(var i in this.sumArr[index].numTextArr){
                    this.sumArr[index].numTextArr[i].status = 1;
                    this.sum_code_data.push(this.sumArr[index].numTextArr[i].num);
                }
            }else if(type === 6){ //012路
                for(var i in this.type012Arr[index].numTextArr){
                    this.type012Arr[index].numTextArr[i].status = 1;
                    this.code_type_012_data.push(this.type012Arr[index].numTextArr[i].num);
                }
            }else if(type === 7){
                for(var i in this.biliaryArr[index].numTextArr){
                    this.biliaryArr[index].numTextArr[i].status = 1;
                    switch(group){
                        case '胆码3':
                            this.hundred_biliary_code_data.push(this.biliaryArr[index].numTextArr[i].num);
                            break;
                        case '胆码2':
                            this.ten_biliary_code_data.push(this.biliaryArr[index].numTextArr[i].num);
                            break;
                        case '胆码1':
                            this.position_biliary_code_data.push(this.biliaryArr[index].numTextArr[i].num);
                            break;
                    }
                }
            }else if(type === 8){ //大小比
                for(var i in this.sizeradioArr[index].numTextArr){
                    this.sizeradioArr[index].numTextArr[i].status = 1;
                    switch(group){
                        case '大小比':
                            this.code_size_data.push(this.sizeradioArr[index].numTextArr[i].num);
                            break;
                        case '奇偶比':
                            this.parity_radio_code_data.push(this.sizeradioArr[index].numTextArr[i].num);
                            break;
                        case '质数比':
                            this.mass_radio_code_data.push(this.sizeradioArr[index].numTextArr[i].num);
                            break;
                    }
                }
            }else if(type === 9){ //奇偶
                for(var i in this.oddevenArr[index].numTextArr){
                    this.oddevenArr[index].numTextArr[i].status = 1;
                    this.odd_even_code_data.push(this.oddevenArr[index].numTextArr[i].num);
                }
            }else if(type === 10){ //大小
                for(var i in this.sizestrArr[index].numTextArr){
                    this.sizestrArr[index].numTextArr[i].status = 1;
                    this.code_size_str_data.push(this.sizestrArr[index].numTextArr[i].num);
                }
            }else if(type === 11){ //质合
                for(var i in this.coincidenceArr[index].numTextArr){
                    this.coincidenceArr[index].numTextArr[i].status = 1;
                    this.code_coincidence_data.push(this.coincidenceArr[index].numTextArr[i].num);
                }
            }
        },

        // 取消全选
        onQuXiaoFun(index,type,group){
            if(type === 0){ //位数
                for(var i in this.fixedArr[index].numTextArr){
                    this.fixedArr[index].numTextArr[i].status = 0;
                    switch(group){
                        case '百位':
                                this.hundred_fixed_code_data = [];
                            break;
                        case '十位':
                                this.ten_fixed_code_data = [];
                            break;
                        case '个位':
                                this.position_fixed_code_data = [];
                            break;
                    }
                }
            }else if(type === 1){ //跨码
                for(var i in this.crossspanArr[index].numTextArr){
                    this.crossspanArr[index].numTextArr[i].status = 0;
                     this.cross_span_code_data = [];
                }
            }else if(type === 2){ //类型
                for(var i in this.formArr[index].numTextArr){
                    this.formArr[index].numTextArr[i].status = 0;
                     this.code_form_data = [];
                }
            }else if(type === 3){ //连号
                for(var i in this.linkCodeArr[index].numTextArr){
                    this.linkCodeArr[index].numTextArr[i].status = 0;
                    this.link_code_data = [];
                }
            }else if(type === 4){ //尾和
                for(var i in this.tailingArr[index].numTextArr){
                    this.tailingArr[index].numTextArr[i].status = 0;
                    this.tailing_code_data = [];
                }
            }else if(type === 5){ //和值
                for(var i in this.sumArr[index].numTextArr){
                    this.sumArr[index].numTextArr[i].status = 0;
                    this.sum_code_data = [];
                }
            }else if(type === 6){ //012路
                for(var i in this.type012Arr[index].numTextArr){
                    this.type012Arr[index].numTextArr[i].status = 0;
                    this.code_type_012_data = [];
                }
            }else if(type === 7){
                for(var i in this.biliaryArr[index].numTextArr){
                    this.biliaryArr[index].numTextArr[i].status = 0;
                    switch(group){
                        case '胆码3':
                            this.hundred_biliary_code_data = [];
                            break;
                        case '胆码2':
                            this.ten_biliary_code_data = [];
                            break;
                        case '胆码1':
                            this.position_biliary_code_data = [];
                            break;
                    }
                }
            }else if(type === 8){ //大小比
                for(var i in this.sizeradioArr[index].numTextArr){
                    this.sizeradioArr[index].numTextArr[i].status = 0;
                    switch(group){
                        case '大小比':
                            this.code_size_data = [];
                            break;
                        case '奇偶比':
                            this.parity_radio_code_data = [];
                            break;
                        case '质数比':
                            this.mass_radio_code_data = [];
                            break;
                    }
                }
            }else if(type === 9){ //奇偶
                for(var i in this.oddevenArr[index].numTextArr){
                    this.oddevenArr[index].numTextArr[i].status = 0;
                    this.odd_even_code_data = [];
                }
            }else if(type === 10){ //大小
                for(var i in this.sizestrArr[index].numTextArr){
                    this.sizestrArr[index].numTextArr[i].status = 0;
                    this.code_size_str_data = [];
                }
            }else if(type === 11){ //质合
                for(var i in this.coincidenceArr[index].numTextArr){
                    this.coincidenceArr[index].numTextArr[i].status = 0;
                    this.code_coincidence_data = [];
                }
            } 
        },

        // 选码切换
        onChangeItem(index,ele,type,group,val){
            if(type === 0){
                if(this.fixedArr[index].numTextArr[ele].status){
                    this.fixedArr[index].numTextArr[ele].status = 0;
                    switch(group){
                        case '百位':
                                let index = this.hundred_fixed_code_data.indexOf(val);
                                if (index > -1) {
                                    this.hundred_fixed_code_data.splice(index, 1);
                                };
                            break;
                        case '十位':
                                index = this.ten_fixed_code_data.indexOf(val);
                                if (index > -1) {
                                    this.ten_fixed_code_data.splice(index, 1);
                                };
                            break;
                        case '个位':
                                index = this.position_fixed_code_data.indexOf(val);
                                if (index > -1) {
                                    this.position_fixed_code_data.splice(index, 1);
                                };
                            break;
                    }
                }else{
                     this.fixedArr[index].numTextArr[ele].status = 1;
                     switch(group){
                        case '百位':
                                this.hundred_fixed_code_data.push(val);
                            break;
                        case '十位':
                                this.ten_fixed_code_data.push(val);
                            break;
                        case '个位':
                                this.position_fixed_code_data.push(val);
                            break;
                    }
                }
            }else if(type === 1){ //跨码
                if(this.crossspanArr[index].numTextArr[ele].status){
                     this.crossspanArr[index].numTextArr[ele].status = 0;
                     index = this.cross_span_code_data.indexOf(val);
                    if (index > -1) {
                        this.cross_span_code_data.splice(index, 1);
                    };
                }else{
                    this.crossspanArr[index].numTextArr[ele].status = 1;
                    this.cross_span_code_data.push(val);
                }
            }else if(type === 2){ //类型 形态
                if(this.formArr[index].numTextArr[ele].status){
                     this.formArr[index].numTextArr[ele].status = 0;
                     index = this.code_form_data.indexOf(val);
                    if (index > -1) {
                        this.code_form_data.splice(index, 1);
                    };
                }else{
                    this.formArr[index].numTextArr[ele].status = 1;
                    this.code_form_data.push(val);
                }
            }else if(type === 3){ //连号
                if(this.linkCodeArr[index].numTextArr[ele].status){
                     this.linkCodeArr[index].numTextArr[ele].status = 0;
                     index = this.link_code_data.indexOf(val);
                    if (index > -1) {
                        this.link_code_data.splice(index, 1);
                    };
                }else{
                    this.linkCodeArr[index].numTextArr[ele].status = 1;
                    this.link_code_data.push(val);
                }
            }else if(type === 4){ //和尾
                if(this.tailingArr[index].numTextArr[ele].status){
                     this.tailingArr[index].numTextArr[ele].status = 0;
                     index = this.tailing_code_data.indexOf(val);
                    if (index > -1) {
                        this.tailing_code_data.splice(index, 1);
                    };
                }else{
                    this.tailingArr[index].numTextArr[ele].status = 1;
                    this.tailing_code_data.push(val);
                }
            }else if(type === 5){ // 和值
                if(this.sumArr[index].numTextArr[ele].status){
                     this.sumArr[index].numTextArr[ele].status = 0;
                     index = this.sum_code_data.indexOf(val);
                    if (index > -1) {
                        this.sum_code_data.splice(index, 1);
                    };
                }else{
                    this.sumArr[index].numTextArr[ele].status = 1;
                    this.sum_code_data.push(val);
                }
            }else if(type === 6){ // 012路
                if(this.type012Arr[index].numTextArr[ele].status){
                     this.type012Arr[index].numTextArr[ele].status = 0;
                     index = this.code_type_012_data.indexOf(val);
                    if (index > -1) {
                        this.code_type_012_data.splice(index, 1);
                    };
                }else{
                    this.type012Arr[index].numTextArr[ele].status = 1;
                    this.code_type_012_data.push(val);
                }
            }else if(type === 7){ // 胆码
                  if(this.biliaryArr[index].numTextArr[ele].status){
                    this.biliaryArr[index].numTextArr[ele].status = 0;
                    switch(group){
                        case '胆码3':
                                let index = this.hundred_biliary_code_data.indexOf(val);
                                if (index > -1) {
                                    this.hundred_biliary_code_data.splice(index, 1);
                                };
                            break;
                        case '胆码2':
                                index = this.ten_biliary_code_data.indexOf(val);
                                if (index > -1) {
                                    this.ten_biliary_code_data.splice(index, 1);
                                };
                            break;
                        case '胆码1':
                                index = this.position_biliary_code_data.indexOf(val);
                                if (index > -1) {
                                    this.position_biliary_code_data.splice(index, 1);
                                };
                            break;
                    }
                }else{
                     this.biliaryArr[index].numTextArr[ele].status = 1;
                     switch(group){
                        case '胆码3':
                                this.hundred_biliary_code_data.push(val);
                            break;
                        case '胆码2':
                                this.ten_biliary_code_data.push(val);
                            break;
                        case '胆码1':
                                this.position_biliary_code_data.push(val);
                            break;
                    }
                }
            }else if(type === 8){ // 大小比/奇偶比/质合比
                 if(this.sizeradioArr[index].numTextArr[ele].status){
                    this.sizeradioArr[index].numTextArr[ele].status = 0;
                    switch(group){
                        case '大小比':
                                let index = this.code_size_data.indexOf(val);
                                if (index > -1) {
                                    this.code_size_data.splice(index, 1);
                                };
                            break;
                        case '奇偶比':
                                index = this.parity_radio_code_data.indexOf(val);
                                if (index > -1) {
                                    this.parity_radio_code_data.splice(index, 1);
                                };
                            break;
                        case '质合比':
                                index = this.mass_radio_code_data.indexOf(val);
                                if (index > -1) {
                                    this.mass_radio_code_data.splice(index, 1);
                                };
                            break;
                    }
                }else{
                     this.sizeradioArr[index].numTextArr[ele].status = 1;
                     switch(group){
                        case '大小比':
                                this.code_size_data.push(val);
                            break;
                        case '奇偶比':
                                this.parity_radio_code_data.push(val);
                            break;
                        case '质合比':
                                this.mass_radio_code_data.push(val);
                            break;
                    }
                }
            }else if(type === 9){ // 奇偶
                if(this.oddevenArr[index].numTextArr[ele].status){
                     this.oddevenArr[index].numTextArr[ele].status = 0;
                     index = this.odd_even_code_data.indexOf(val);
                    if (index > -1) {
                        this.odd_even_code_data.splice(index, 1);
                    };
                }else{
                    this.oddevenArr[index].numTextArr[ele].status = 1;
                    this.odd_even_code_data.push(val);
                }
            }else if(type === 10){ // 大小
                if(this.sizestrArr[index].numTextArr[ele].status){
                     this.sizestrArr[index].numTextArr[ele].status = 0;
                     index = this.code_size_str_data.indexOf(val);
                    if (index > -1) {
                        this.code_size_str_data.splice(index, 1);
                    };
                }else{
                    this.sizestrArr[index].numTextArr[ele].status = 1;
                    this.code_size_str_data.push(val);
                }
            }else if(type === 11){
                if(this.coincidenceArr[index].numTextArr[ele].status){
                     this.coincidenceArr[index].numTextArr[ele].status = 0;
                     index = this.code_coincidence_data.indexOf(val);
                    if (index > -1) {
                        this.code_coincidence_data.splice(index, 1);
                    };
                }else{
                    this.coincidenceArr[index].numTextArr[ele].status = 1;
                    this.code_coincidence_data.push(val);
                }
            }
        },
        // 生成
        onGenerateFun(){
            this.is_turn=0;
            this.is_client_export = 0;
            this.postClientShrinkageToolDataOfBlessing();
        },

        // 转组选
        onRotationGroupFun(){
            this.is_turn=1;
            this.is_client_export = 0;
            this.postClientShrinkageToolDataOfBlessing();
        },

        // 导出
        onExportFun(){
            this.is_turn=0;
            this.is_client_export = 1;
            this.postClientShrinkageToolDataOfBlessing();
        },

        // 复制
        onCopyFun(){
            let text=document.getElementById("textCont");
            text.select(); // 选择对象
            document.execCommand("Copy");  //执行浏览器拷贝
        },

        // 重置所有条件
        onResetFun(){
            this.resetNum();
            this.NumVal='';
            this.total_num=0;
        },

        // 重置所有条件
        resetNum(){
             // 各个标签杀码定码字段
            this.hundred_fixed_code_type=1, //百位定码
            this.ten_fixed_code_type=1, //十位定码
            this.position_fixed_code_type=1, //个位定码
            this.hundred_biliary_code_type=1, //百位胆码
            this.ten_biliary_code_type=1, //十位胆码
            this.position_biliary_code_type=1, //个位胆码
            this.cross_span_code_type=1, //跨码
            this.code_form_type=1, //定码
            this.code_size_str_type=1, //大小
            this.odd_even_code_type=1, //奇偶
            this.code_coincidence_type=1, //质合
            this.code_size_type=1, //大小比
            this.parity_radio_code_type=1, //奇偶比
            this.mass_radio_code_type=1, //质合比
            this.link_code_type=1, //连号
            this.sum_code_type=1, //和值
            this.tailing_code_type=1, // 和尾
            this.code_type_012_type=1, //012路
             // 数组
            this.hundred_fixed_code_data=[], //百位定码
            this.ten_fixed_code_data=[], //十位定码
            this.position_fixed_code_data=[], //个位定码
            this.hundred_biliary_code_data=[], //百位胆码
            this.ten_biliary_code_data=[], //十位胆码
            this.position_biliary_code_data=[], //个位胆码
            this.cross_span_code_data=[], //跨码
            this.code_form_data=[], //定码
            this.code_size_str_data=[], //大小
            this.odd_even_code_data=[], //奇偶
            this.code_coincidence_data=[], //质合
            this.code_size_data=[], //大小比
            this.parity_radio_code_data=[], //奇偶比
            this.mass_radio_code_data=[], //质合比
            this.link_code_data=[], //连号
            this.sum_code_data=[], //和值
            this.tailing_code_data=[], // 和尾
            this.code_type_012_data=[];//012路
            for(let i in this.fixedArr){
                this.fixedArr[i].isChangedmBox = false;
                for(let k in  this.fixedArr[i].numTextArr){
                    this.fixedArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.crossspanArr){
                this.fixedArr[i].crossspanArr = false;
                for(let k in  this.crossspanArr[i].numTextArr){
                    this.crossspanArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.formArr){
                this.fixedArr[i].formArr = false;
                for(let k in  this.formArr[i].numTextArr){
                    this.formArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.linkCodeArr){
                this.fixedArr[i].linkCodeArr = false;
                for(let k in  this.linkCodeArr[i].numTextArr){
                    this.linkCodeArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.tailingArr){
                this.fixedArr[i].tailingArr = false;
                for(let k in  this.tailingArr[i].numTextArr){
                    this.tailingArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.sumArr){
                this.fixedArr[i].sumArr = false;
                for(let k in  this.sumArr[i].numTextArr){
                    this.sumArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.type012Arr){
                this.type012Arr[i].sumArr = false;
                for(let k in  this.type012Arr[i].numTextArr){
                    this.type012Arr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.biliaryArr){
                this.biliaryArr[i].sumArr = false;
                for(let k in  this.biliaryArr[i].numTextArr){
                    this.biliaryArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.oddevenArr){
                this.oddevenArr[i].sumArr = false;
                for(let k in  this.oddevenArr[i].numTextArr){
                    this.oddevenArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.sizeradioArr){
                this.sizeradioArr[i].sumArr = false;
                for(let k in  this.sizeradioArr[i].numTextArr){
                    this.sizeradioArr[i].numTextArr[k].status = 0;
                }
            }
            for(let i in this.sizestrArr){
                this.sizestrArr[i].sumArr = false;
                for(let k in  this.sizestrArr[i].numTextArr){
                    this.sizestrArr[i].numTextArr[k].status = 0;
                }
            }
             for(let i in this.coincidenceArr){
                this.coincidenceArr[i].sumArr = false;
                for(let k in  this.coincidenceArr[i].numTextArr){
                    this.coincidenceArr[i].numTextArr[k].status = 0;
                }
            }
        },

        // 获取网络数据
        postClientShrinkageToolDataOfBlessing(){
            let lottery_id = this.$store.state.lottery_id;
            this.https('Analyse/postClientShrinkageToolDataOfBlessing',{
                lottery_id:lottery_id,
                star_num: this.star_num,
                is_turn: this.is_turn,
                hundred_fixed_code:{
                    type: this.hundred_fixed_code_type,
                    data: this.hundred_fixed_code_data.toString()
                },
                ten_fixed_code:{
                    type: this.ten_fixed_code_type,
                    data: this.ten_fixed_code_data.toString()
                },
                position_fixed_code:{
                    type: this.position_fixed_code_type,
                    data: this.position_fixed_code_data.toString()
                },
                hundred_biliary_code:{
                    type: this.hundred_biliary_code_type,
                    data: this.hundred_biliary_code_data.toString()
                },
                ten_biliary_code:{
                    type: this.ten_biliary_code_type,
                    data: this.ten_biliary_code_data.toString()
                },
                position_biliary_code:{
                    type: this.position_biliary_code_type,
                    data: this.position_biliary_code_data.toString()
                },
                cross_span_code:{
                    type: this.cross_span_code_type,
                    data: this.cross_span_code_data.toString()
                },
                code_form:{
                    type: this.code_form_type,
                    data: this.code_form_data.toString()
                },
                code_size_str:{
                    type: this.code_size_str_type,
                    data: this.code_size_str_data.toString()
                },
                odd_even_code:{
                    type: this.odd_even_code_type,
                    data: this.odd_even_code_data.toString()
                },
                code_coincidence:{
                    type: this.code_coincidence_type,
                    data: this.code_coincidence_data.toString()
                },
                code_size:{
                    type: this.code_size_type,
                    data: this.code_size_data.toString()
                },
                parity_radio_code:{
                    type: this.parity_radio_code_type,
                    data: this.parity_radio_code_data.toString()
                },
                mass_radio_code:{
                    type: this.mass_radio_code_type,
                    data: this.mass_radio_code_data.toString()
                },
                link_code:{
                    type: this.link_code_type,
                    data: this.link_code_data.toString()
                },
                sum_code:{
                    type: this.sum_code_type,
                    data: this.sum_code_data.toString()
                },
                tailing_code:{
                    type: this.tailing_code_type,
                    data: this.tailing_code_data.toString()
                },
                code_type_012:{
                    type: this.code_type_012_type,
                    data: this.code_type_012_data.toString()
                }
            },'post')
            .then(data => {
                        let root = '';
                        this.total_num = data.total_num;
                        for(var i in data.list){
                            if(root == ''){
                                root = data.list[i]
                            }else{
                                root = root +' '+data.list[i]
                            }
                        }
                    if(this.total_num != 0){
                        if(this.is_client_export == 1){
                            this.ondownload(root);
                        }else{
                            this.NumVal = root;
                        }
                    }else{
                        this.$toast({message:'本次生成0注，请重新选择号码缩水条件。'});
                        this.NumVal = '';
                    }
            });
        },

        // 下载文件
        ondownload(data){ //下载txt文件
            var CaiPiaoLabel = this.$store.state.CaiPiaoLabel;
            var name = `[彩盟计划][${CaiPiaoLabel}]${this.file_name}`
            download(data, name, "text/plain");
        }
    }
}
</script>
<style lang="less" scoped>
@import url(../../assets/css/shrinkagetool/shrinkagetoolthreebits.less);
</style>


